package com.hamll.common.client;

import com.hamll.common.dto.ItemDTO;
import com.hamll.common.dto.PageDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient("itemservice")//远程调用
public interface ItemClient {


    @GetMapping("/item/findByPage")
    PageDTO<ItemDTO> findByPage4Search(
            @RequestParam(name = "page")Integer page,
            @RequestParam(name = "size")Integer size);

    /**
     * 根据主键id查询
     * @param id
     * @return
     */
    @GetMapping("/item/getById/{id}")
    ItemDTO getById(@PathVariable(name = "id")Long id);


    @PutMapping("/item/stock/{itemId}/{num}")
    void updateStock(@PathVariable("itemId") Long itemId, @PathVariable("num") Integer num);

}
